#include "formredis.h"
#include "ui_formredis.h"
#include "ui_formredis.h"
#include <QApplication>
#include<QDebug>
#include<QString>
#include<QMessageBox>
#include<hiredis/hiredis.h>
#include<QLineEdit>
Formredis::Formredis(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Formredis)
{
    ui->setupUi(this);
}

Formredis::~Formredis()
{
    delete ui;
}
void Formredis::on_pushButtonStartconnect_clicked()
{
    QString servername1s = ui->lineEditServer->text();
    QString servername2s = ui->lineEditPassword->text();
    const char* servername1 = servername1s.toUtf8().data();
    int servername2=servername2s.toInt();
    redisContext *redisContext = redisConnect(servername1, servername2);
    if (redisContext == nullptr || redisContext->err)
    {
        QMessageBox::information(this, "连接失败", "连接失败");

    }
    else
    {
        QMessageBox::information(this, "连接成功", "连接成功");
    }
    this->close();
}

